//
//  TTCaculatorKeyboardViewCell.m
//  TaoTuo
//
//  Created by admin on 2020/2/5.
//  Copyright © 2020 admin. All rights reserved.
//

#import "TTCaculatorKeyboardViewCell.h"

@interface TTCaculatorKeyboardViewCell ()

@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UIImageView *imageView;

@end

@implementation TTCaculatorKeyboardViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.backgroundColor = UIColorHex(F0F4F7);
        _titleLabel = [UILabel labelTextCenterWithTitle:@"" color:UIColorHex(333333) fontSize:18];
        _titleLabel.frame = self.bounds;
        _titleLabel.hidden = YES;
        [self addSubview:_titleLabel];
        
        _imageView = [[UIImageView alloc] initWithFrame:self.bounds];
        _imageView.contentMode = UIViewContentModeCenter;
        _imageView.hidden = YES;
        [self addSubview:_imageView];
        
    }
    return self;
}

- (void)setTitle:(NSString *)title
{
    _title = title;
    if ([title isEqualToString:@"delete_keyboard"]) {
        _titleLabel.hidden = YES;
        _imageView.hidden = NO;
        _imageView.image = [UIImage imageNamed:title];
    } else {
        _titleLabel.hidden = NO;
        _imageView.hidden = YES;
        _titleLabel.text = title;
    }
}

- (void)setHighlighted:(BOOL)highlighted
{
    [super setHighlighted:highlighted];
    
    if (highlighted) {
        self.backgroundColor = kMainColor;
        self.titleLabel.textColor = [UIColor whiteColor];
    } else {
        self.backgroundColor = UIColorHex(F0F4F7);
        self.titleLabel.textColor = UIColorHex(333333);
    }
}


@end
